home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-serious-
/
programming
/
other
/
gui4cli
/
docs
/
tutorials
/
mousedata.gc
< prev
next >
Wrap
Text File
|
1999-05-14
|
2KB
|
72 lines
G4C
; ----- Obtaining feedback on mouse position and
; the colour of the pixel clicked on
; =================================================================
; Globals & system events
; =================================================================
WINBIG 155 60 331 131 "MouseData.gc"
WinType 11110001
xonLoad
GuiOpen MouseData.gc
xonClose
GuiQuit MouseData.gc
; =================================================================
; Graphics..
; =================================================================
BOX 0 0 0 0 OUT button
; ---- A box surrounding the area event below
; Note they are the same size/position
BOX 37 30 255 80 IN RIDGE
; ---- 3 colored shapes
SQUARE 56 40 37 60 1 FILL
CIRCLE 165 70 56 30 2 FILL
SQUARE 236 40 37 60 3 FILL
; ---- Headings above the box
CTEXT 37 5 'MouseData:' #screen 8 2 0 0001
TEXT 37 18 189 12 'Click within the box' 20 NOBOX
; ---- Text gadgets to contain feedback below the box
TEXT 44 113 47 12 '' 10 NOBOX
gadid 1
TEXT 127 113 47 12 '' 10 NOBOX
gadid 2
TEXT 210 113 47 12 '' 10 NOBOX
gadid 3
; =================================================================
; The important stuff
; -------------------
; Marking the 'area' of the box serves two purposes :
; 1 Clicking within the area provides us with an 'event'
; to which a reaction can be coded
; 2 It restricts events and feedback to the area required.
; We read the values of $$MOUSE.WX, $$MOUSE.WY, and $$MOUSE.COLOR
; to obtain the required information.
; =================================================================
XAREA 37 30 255 80 NONE
update MouseData.gc 1 'X = $$MOUSE.WX'
update MouseData.gc 2 'Y = $$MOUSE.WY'
update MouseData.gc 3 'Colour = $$MOUSE.COLOR'
; =================================================================
; Note that X and Y can also be obtained as SCREEN coordinates,
; but here we read only the window coordinates.